<template>
	<view>
        <u-popup :show="show" mode="bottom"  @close="closeShow" :round="23">
			<div>
				<div class="popupTitle" style="text-align: left;padding-left:16px;">
					<img src="https://pic.moresu.com/FvrReiN9BLYzIoiRyQJ6ih2RM64J" style="width:15px;height:17px;display: inline-block;vertical-align: middle;"/>
					<span style="padding-left:20rpx;vertical-align: middle;">选择店铺</span>
				</div>
				<div class="popup-con" style="padding:0 24px 16px 24px;margin-top:10px">
					 <u-radio-group v-model="value" :borderBottom="true" placement="column" iconPlacement="right" @change="changeValue">
						
						<u-radio :customStyle="{marginBottom: '16px'}" v-for="(item, index) in list" :key="index" :name="item.storeId" >
						   <div class="store-name-radio">
						       <div>{{item.storeName}}</div>
							   <div style="margin-left:20rpx" v-if="item.isMain == 1">
								   <u-tag text="主" size="mini"   plain ></u-tag>
							   </div>
							   <div style="margin-left:20rpx"  v-if="item.isAuth == 1">
								   <u-tag text="认证" size="mini" type="success"  plain ></u-tag>
							   </div> 
						  </div>
						</u-radio>
					 </u-radio-group>
				</div>
				<div style="width:100%;padding:24rpx;bottom:0;background: #fff;border-top:1px solid #eee">
				  <u-button text="新增店铺" shape="circle" type="primary" @click="toCheckIn"></u-button>
				</div>
			</div>
        </u-popup>
	</view>
</template>
<script>


import {userSellerStore} from '@/config/api.js'
import store from '@/store';


export default {
    name: 'chooseColor',
 
	mounted() {
	 
	},
	data() {
		return {
			height:'',
            show:false,
			value:'',
			list:[],
			storeUserInfo:{},
	
		}
	},
    watch:{

    },
	
	methods: {
		
		init(storeId){
			this.show = true;
			this.storeUserInfo = store.state.userInfo;
			this.value = storeId
			this.getStoreList();
		},
		//店铺公司列表
		getStoreList(){
			userSellerStore().then((res)=>{
				this.list = res
			})
		},
       changeValue(){
		   let i = this.list.findIndex((el)=>{
			   return el.storeId == this.value
		   })
		   if( i!=-1){
			 this.$emit('chooseItem',this.list[i])
			 this.show = false    
		   }
		  
	   },
	   closeShow(){
		   this.show = false
	   },
	   toCheckIn(){
		   this.show = false
		   uni.navigateTo({
				url: '/pagesUser/business/businessCheckIn'
		   })
	   },
          
	}
};
</script>

<style lang="scss" scoped>
@import '@/style/common.scss';
.popupTitle{
	font-size:$b-font;
	font-weight: bold;
	text-align: center;
	line-height: 50px;
}
   .popup-con{
    	padding:0 16px 16px 16px;
    	.store-name-radio{
			@include flexbox(flex-start,center);
		}
    
    }
    .popup-bottom{
    	background: #fff;
    	margin-top:10px;
    	padding:16px;
    }
    .popup-bottom-fixed{
    	position: fixed;
    	width:100%;
    	padding:16px;
    	box-sizing: border-box;
    	bottom:0
    }
    
    

</style>
